package com.senlingspace.payment.douyin.bean.request;

import com.alibaba.fastjson2.JSON;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.senlingspace.payment.douyin.DouyinFunctionEnum;
import com.senlingspace.payment.douyin.bean.response.DouyinQueryRefundResponse;
import lombok.Data;

/**
 * 查询退款
 * <p>
 * 三个字段任选其一即可
 *
 * @author lebronjames
 * @date 2024/08/02
 */
@Data
public class DouyinQueryRefundRequest implements DouyinRequest<DouyinQueryRefundResponse> {

    /**
     * 抖音开平内部交易退款单号，长度 <=  64byte
     * <p>
     * 当有refund_id时，优先使用refund_id查询
     */
    @JsonProperty("refund_id")
    private String refundId;

    /**
     * 开发者系统生成的退款单号，长度 <=  64byte
     */
    @JsonProperty("out_refund_no")
    private String outRefundNo;

    /**
     * 抖音开平内部交易订单号，    长度 <=  64byte
     */
    @JsonProperty("order_id")
    private String orderId;

    @Override
    public DouyinFunctionEnum getFunction() {
        return DouyinFunctionEnum.query_refund;
    }

    @Override
    public String getBody() {
        DouyinQueryRefundRequest request = new DouyinQueryRefundRequest();
        request.setRefundId(this.refundId);
        request.setOutRefundNo(this.outRefundNo);
        request.setOrderId(this.orderId);
        return JSON.toJSONString(request);
    }

    @Override
    public Class<DouyinQueryRefundResponse> getResponseType() {
        return DouyinQueryRefundResponse.class;
    }

}
